#include "ZipNavigator.h"
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <math.h>


void ZipNavigator::navigateFunction(FileHeader* fileHeader)
{
    float compressionPercentage = fileHeader->calculateCompressionPercentage();

    std::cout.width(ZipNavigator::maxFileNameLength_);
    std::cout << std::left << fileHeader->fileName_;
    std::cout.width(25);
    std::cout << std::right << fileHeader->parseTimeToString().c_str();
    std::cout.width(5);
    std::cout << std::setprecision(4) << std::right << compressionPercentage << "%" << std::endl;
    //    printf("Name: %s \n%s%.2f%%\n\n",
    //           fileHeader->fileName_, fileHeader->parseTimeToString().c_str(), compressionPercentage);
}

void ZipNavigator::calculateMaxFileNameLength(FileHeader* fileHeader){
 
    ZipNavigator::maxFileNameLength_  = fmax(ZipNavigator::maxFileNameLength_,fileHeader->fileNameLength_);
}